<?php
use yii\grid\GridView;
use common\helpers\Url;
use common\helpers\Html;

$this->title = '项目列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
    thead th{
        text-align: center;
    }
    tbody td{
        text-align:center;
    }
</style>
<div class="row">
    <div class="col-xs-12">
        <div class="nav-tabs-custom">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="box-tools">
                    <?= Html::create(['edit','li'=>$li], '创建') ?>
                </div>
            </div>

            <div class="tab-content">
                <div class="active tab-pane">
                    <?= GridView::widget([
                        'dataProvider' => $dataProvider,
                        'filterModel' => $searchModel,
                        //重新定义分页样式
                        'tableOptions' => ['class' => 'table table-hover'],
                        'options' => ['class' => 'table table-hover'],
                        'columns' => [
                            'id',
                            'module',
                            'title',
                            [
                                'attribute' => 'cates.name',
                                'filter' => false, //不显示搜索框
                            ],
                            [
                                'attribute'=>'out_time',
                                'filter' => false, //不显示搜索框
                            ],
                            [
                                'attribute'=>'status',
                                'filter' => false, //不显示搜索框
                                'value'=>function($model){
                                     switch($model->status){
                                         case 1:
                                             return '进行中';
                                             break;
                                         case 2:
                                             return '已完成';
                                             break;
                                     }
                                }
                            ],
                            [
                                'header' => "操作",
                                'class' => 'yii\grid\ActionColumn',
                                'template'=> '{edit} {delete}{see}',
                                'buttons' => [
                                    'edit' => function ($url, $model, $key) {
                                        return Html::edit(['edit', 'id' => $model->id]);
                                    },
                                    'delete' => function ($url, $model, $key) {
                                        return Html::delete(['delete', 'id' => $model->id]);
                                    }
                                ],
                            ],
                        ]
                    ]); ?>
                </div>
            </div>

        </div>
    </div>
</div>

